<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 梁家源
  Date: 2021/4/20
  Time: 11:03
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理员个人信息</title>
    <!-- layUI的核心CSS文件 -->
    <link rel="stylesheet" type="text/css"
          href="${pageContext.request.contextPath}/static/layui-v2.5.7/layui/css/layui.css"/>
    <!-- layUI的核心JS文件 -->
    <script src="${pageContext.request.contextPath}/static/layui-v2.5.7/layui/layui.js" type="text/javascript"
            charset="UTF-8"></script>
    <script src="${pageContext.request.contextPath}/static/script/jquery-1.7.2.js" type="text/javascript"
            charset="UTF-8"></script>
</head>
<body>
<script>
    layui.use('element', function () {
        var element = layui.element;
    });

    layui.use('form', function () {
        var form = layui.form;
    });

    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#adminHeadPage' //绑定元素
            ,url: '${pageContext.request.contextPath}/updateAdminInfo' //上传接口
            ,done: function(res){
                //上传完毕回调
            }
            ,error: function(){
                //请求异常回调
            }
        });
    });
</script>

<!-- 管理员登录状态下的头部导航栏 -->
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo"><a style="color: #009688;">龙洞闲置购物系统</a></div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item">
                <a href="gotoAdminConsole">后台首页</a>
            </li>
            <li class="layui-nav-item layui-this" style="user-select: none">
                修改资料
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <!-- 如果管理员已登录 -->
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <c:if test="${empty sessionScope.admin.aheadsrc}">
                        <img src="${pageContext.request.contextPath}/static/images/default_head.jpg"
                             class="layui-nav-img"
                            <%--                         style="width: 50px; height: 50px;margin-left: 15px;"--%>
                        >
                        管理员${sessionScope.admin.aname}
                    </c:if>
                    <c:if test="${not empty sessionScope.admin.aheadsrc}">
                        <img src="${admin.aheadsrc}" class="layui-nav-img"
                            <%--                         style="width: 50px; height: 50px;margin-left: 15px;"--%>
                        >
                        管理员${sessionScope.admin.aname}
                    </c:if>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="${pageContext.request.contextPath}/readAdminInfo">
                        <i class="layui-icon">&#xe68e;</i>&nbsp;我的信息</a></dd>
                    <dd><a href="${pageContext.request.contextPath}/toAdminPasswordPage">
                        <i class="layui-icon">&#xe683;</i>&nbsp;安全设置</a>
                    </dd>
<%--                    <dd><a href="gotoAdminConsole">--%>
<%--                        <i class="layui-icon">&#xe665;</i>&nbsp;进入后台</a></dd>--%>
                    <dd><a href="ShowALLGoods">
                        <i class="layui-icon">&#xe665;</i>&nbsp;商城首页</a>
                    </dd>
                    <dd><a href="${pageContext.request.contextPath}/adminLoginOut">
                        <i class="layui-icon">&#xe682;</i>&nbsp;退出登录</a></dd>
                </dl>
            </li>
        </ul>
    </div>
</div>

<%--管理员个人信息主体内容--%>

    <div class="layui-container" style="margin-top: 50px;padding-left: 200px;padding-right: 200px">
        <fieldset class="layui-elem-field layui-field-title" >
            <legend style="margin-left: 50px;">${admin.aname}管理员的个人信息</legend>
        </fieldset>
        <form class="layui-form layui-form-pane" action="${pageContext.request.contextPath}/updateAdminInfo" enctype="multipart/form-data" method="post">
            <div class="layui-row">
                <div class="layui-col-md5" style="padding-top: 5px">
                    <%--管理员头像--%>
                    <div class="layui-form-item" style="position: relative">
                        <div class="layui-input-inline" style="height: 250px">
                            <c:if test="${empty sessionScope.admin.aheadsrc}">
                                <img id="" type="file" src="${pageContext.request.contextPath}/static/images/default_head.jpg"
                                     class="layui-nav-img"
                                     style="max-width: 250px; max-height: 250px;margin-left: 15px;">
                            </c:if>
                            <c:if test="${not empty sessionScope.admin.aheadsrc}">
                                <img id="adminHeadPage" src="${admin.aheadsrc}" class="layui-nav-img"
                                     style="width: 250px; height: 250px;margin-left: 5px;">
                            </c:if>
                            <input type="hidden" name="aheadsrc" value="${admin.aheadsrc}">
                        </div>
                        <div class="layui-input-inline" >
                            <input type="file" name="aheadimg">
                        </div>
                    </div>
                </div>
                <div class="layui-col-md7">
                    <div class="layui-form-item">
                        <label class="layui-form-label">I&nbsp;D</label>
                        <div class="layui-input-block">
                            <input type="text" name="aid" required lay-verify="required" value="${admin.aid}" autocomplete="off" class="layui-input" readonly>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">密码</label>
                        <div class="layui-input-block">
                            <input type="text" name="apassword" required lay-verify="required" value="${admin.apassword}" autocomplete="off"  class="layui-input" readonly>
                        </div>
                        <%--                <div class="layui-form-mid layui-word-aux">辅助文字</div>--%>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="aname" required lay-verify="required" value="${admin.aname}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item" >
                        <label class="layui-form-label">院系</label>
                        <div class="layui-input-block">
                            <select name="afaculty" lay-verify="required">
                                <option value="${admin.afaculty}" selected>${admin.afaculty}</option>
                                <option value="管理学院">管理学院</option>
                                <option value="计算机学院">计算机学院</option>
                                <option value="经济与贸易学院">经济与贸易学院</option>
                                <option value="应用数学学院">应用数学学院</option>
                                <option value="政法学院">政法学院</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">手机</label>
                        <div class="layui-input-block">
                            <input type="text" name="aphone" required  lay-verify="required" value="${admin.aphone}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
                        </div>
                    </div>

                </div>
            </div>

        </form>

    </div>

</body>
</html>
